/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.dataObjects;

import assignment_cp3120.DAO.Factory.DAOFactory;
import java.util.Vector;

/**
 *
 * @author Administrator
 */
public class AllFlights {
    private static Vector<Flight> instance;
    protected AllFlights() {
    }
    public static Vector<Flight> getInstance() {
        if (instance == null) {
            instance = DAOFactory.getDAOFactory().getFlightDAO().getFlights();
        }
        return instance;
    }
    public static void add(Flight flight){
        DAOFactory.getDAOFactory().getFlightDAO().createFlight(flight);
        instance.add(flight);        
    }
    public static void remove(Flight flight){
        instance.remove(flight);
        DAOFactory.getDAOFactory().getFlightDAO().deleteFlight(flight.getFlight_id());
    }
}
